# 计算党费
# 注意，这里的题干描述有问题，退休职工也不是累进的

ch=input("")
s=eval(input(""))

df = float(0)
if ch == "y" or ch == "Y":
    if s <= 5000:
        df = s * 0.005
    else:
        df = s * 0.01
else:
    if s <= 3000:
        df = s * 0.005
    elif 3000 < s <= 5000:
        df = s * 0.01
    elif 5000 < s <= 10000:
        df = s * 0.015
    elif s > 10000:
        df = s * 0.02

print("{:.2f}".format(df))